{volist name="data" id="vo" key="key"}
    {if (!empty($vo['setting']))}
    {php}$vo['setting'] = json_decode($vo['setting'], true);{/php}
    {/if}
    {if in_array($vo['form_type'], ['text', 'number'])}
    <div class="form-group row">
        <label for="frm-{$vo['field_name']}" class="col-sm-2 col-12 row-form-label">{:__($vo['field_title'])}</label>
        <div class="col-sm-8 col-12">
            {:build_input($vo['form_type'], 'row['.$vo['field_name'].']', $row[$vo['field_name']]??$vo['default_value'], extend_options([
            'class'=>'form-control',
            'id'=>'frm-'.$vo['field_name'],
            'placeholder'=>$vo['tips'],
            'step'=>$vo['decimals']==0 ? 1 : 1/('1'.str_repeat('0',$vo['decimals'])),
            'data-rule'=>str_replace(',',';',$vo['rules']),
            'data-msg'=>$vo['error_tips']
            ], $vo['extend']))}
        </div>
        <div class="col-sm-2 form-tips">{if !empty($vo['tips'])}<span class="form-tips-span" data-tips="{$vo['tips']}"><i class="far fa-question-circle"></i></span>{/if}</div>
    </div>
    {elseif in_array($vo['form_type'],['selectpage']) /}
    <div class="form-group row">
        <label for="frm-{$vo['field_name']}" class="col-sm-2 col-12 row-form-label">{:__($vo['field_title'])}</label>
        <div class="col-sm-8 col-12">
            <?php $vo['extend'] = extend_options([
            'id'=>'frm-'.$vo['field_name'],
            'placeholder'=>$vo['tips'],
            'data-rule'=>str_replace(',',';',$vo['rules']),
            'data-msg'=>$vo['error_tips']
            ], $vo['extend']); ?>

            <?php $vo['extend'] = array_merge($vo['extend'], [
            'class'=>'form-control selectpage',
            'data-data'=>$vo['data_list']['type']=='url'?url($vo['data_list']['url']):url('/common/getSelectpage',['t'=>isset($t)?$t:1,'id'=>$vo['id']]),
            'data-params'=>!empty($vo['data_list']['param'])?json_encode($vo['data_list']['param']):'',
            'data-multiple'=>!empty($vo['data_list']['multiple'])?'true':'false',
            'data-pagination'=>!empty($vo['data_list']['pagination'])?'false':'true',
            'data-select-only'=>!empty($vo['data_list']['select-only'])?'true':'false',
            'data-and-or'=>!empty($vo['data_list']['and-or'])?$vo['data_list']['and-or']:'and',
            'data-order-by'=>!empty($vo['data_list']['order-by'])?json_encode(explode(',',$vo['data_list']['order-by'])):''
            ]);?>

            {if $vo['data_list']['type']=='url'}
            <?php $vo['extend'] = array_merge($vo['extend'], [
            'data-show-field'=>!empty($vo['url_data_list']['url-show-field'])?$vo['data_list']['url-show-field']:'title',
            'data-search-field'=>!empty($vo['data_list']['url-search-field'])?$vo['data_list']['url-search-field']:'title',
            'data-key-field'=>!empty($vo['data_list']['url-key-field'])?$vo['data_list']['url-key-field']:'id',
            ]);?>
            {else /}
            <?php $vo['extend'] = array_merge($vo['extend'], [
            'data-show-field'=>!empty($vo['data_list']['show-field'])?$vo['data_list']['show-field']:'title',
            'data-search-field'=>!empty($vo['data_list']['search-field'])?$vo['data_list']['search-field']:'title',
            'data-key-field'=>!empty($vo['data_list']['key-field'])?$vo['data_list']['key-field']:'id',
            ]);?>
            {/if}

            {:build_input('text', 'row['.$vo['field_name'].']', $row[$vo['field_name']]??$vo['default_value'], $vo['extend'])}
        </div>
        <div class="col-sm-2 form-tips">{if !empty($vo['tips'])}<span class="form-tips-span" data-tips="{$vo['tips']}"><i class="far fa-question-circle"></i></span>{/if}</div>
    </div>
    {elseif in_array($vo['form_type'],['textarea','editor']) /}
    <div class="form-group row">
        <label for="frm-{$vo['field_name']}" class="col-sm-2 col-12 row-form-label">{:__($vo['field_title'])}</label>
        <div class="col-sm-8 col-12">
            {:build_textarea('row['.$vo['field_name'].']', $row[$vo['field_name']]??$vo['default_value'], extend_options([
                'class'=>'form-control '.($vo['form_type']=='editor'?'editor':''),
                'id' => 'frm-'.$vo['field_name'],
                'placeholder'=>$vo['tips'],
                'data-rule'=>str_replace(',',';',$vo['rules']),
                'data-msg'=>$vo['error_tips'],
                'rows'=>3
            ], $vo['extend']))}
        </div>
        <div class="col-sm-2 form-tips">{if !empty($vo['tips'])}<span class="form-tips-span" data-tips="{$vo['tips']}"><i class="far fa-question-circle"></i></span>{/if}</div>
    </div>
    {elseif ($vo['form_type']=='radio')}
        {if !empty($vo['data_list'])}
        <div class="form-group row">
            <label class="col-sm-2 col-12 row-form-label">{:__($vo['field_title'])}</label>
            <div class="col-sm-8 col-12">
                <div class="radio-group">
                    {volist name="vo['data_list']" id="item"}
                    <div class="radio-item">
                        <input id="row[{$vo['field_name']}]-{$i}"
                               {if isset($vo['default_value'])&&!isset($row[$vo['field_name']])&&$vo['default_value']==$key}checked="checked"{elseif $i==1&&!isset($vo['default_value'])&&!isset($row[$vo['field_name']]) /}checked="checked"{elseif isset($row[$vo['field_name']])&&$row[$vo['field_name']]==$key }checked="checked"{/if}
                        name="row[{$vo['field_name']}]" type="radio" value="{$key}"
                        {if $i==1}data-rule="{:str_replace([',','required'],[';','checked'],$vo['rules'])}" data-msg="{$vo['error_tips']}"{/if} >
                        <label for="row[{$vo['field_name']}]-{$i}">{$item}</label>
                    </div>
                    {/volist}
                </div>
            </div>
            <div class="col-sm-2 form-tips">{if !empty($vo['tips'])}<span class="form-tips-span" data-tips="{$vo['tips']}"><i class="far fa-question-circle"></i></span>{/if}</div>
        </div>
        {/if}
    {elseif $vo['form_type']=='checkbox' /}
        {if !empty($vo['data_list'])}
        <div class="form-group row">
            <label class="col-sm-2 col-12 row-form-label">{:__($vo['field_title'])}</label>
            <div class="col-sm-8 col-12">
                <div class="radio-group">
                    {php}$haystack = isset($row[$vo['field_name']])?explode(',', $row[$vo['field_name']]):explode(',', $vo['default_value']);{/php}
                    {volist name="vo['data_list']" id="item"}
                    <div class="radio-item"><input id="row[{$vo['field_name']}]-{$i}"
                           {if in_array($key,$haystack)}checked{/if}
                    name="row[{$vo['field_name']}][]" type="checkbox" value="{$key}"
                    {if $i==1}data-rule="{:str_replace([',','required'],[';','checked'],$vo['rules'])}" data-msg="{$vo['error_tips']}"{/if} >
                    <label for="row[{$vo['field_name']}]-{$i}">{$item}</label></div>
                    {/volist}
                </div>
            </div>
            <div class="col-sm-2 form-tips">{if !empty($vo['tips'])}<span class="form-tips-span" data-tips="{$vo['tips']}"><i class="far fa-question-circle"></i></span>{/if}</div>
        </div>
        {/if}
    {elseif in_array($vo['form_type'], ['select', 'selects']) /}
    <div class="form-group row">
        <label class="col-sm-2 col-12 row-form-label">{:__($vo['field_title'])}</label>
        <div class="col-sm-8 col-12">
            {php}$haystack = isset($row[$vo['field_name']])?explode(',', $row[$vo['field_name']]):explode(',', $vo['default_value']);{/php}
            <select {:extend_options([
            'class'=>'form-control',
            'id' => 'frm-'.$vo['field_name'],
            'data-rule'=>str_replace(',',';',$vo['rules']),
            'data-msg'=>$vo['error_tips'],
            ], $vo['extend'], true)}
                    name="row[{$vo['field_name']}]{if $vo['form_type']=='selects'}[]{/if}"
                    {if $vo['form_type']=='selects'}multiple{/if}>
                {volist name="vo['data_list']" id="item"}
                <option value="{$key}" {if in_array($key, $haystack)}selected{/if}>{$item}</option>
                {/volist}
            </select>
        </div>
        <div class="col-sm-2 form-tips">{if !empty($vo['tips'])}<span class="form-tips-span" data-tips="{$vo['tips']}"><i class="far fa-question-circle"></i></span>{/if}</div>
    </div>
    {elseif in_array($vo['form_type'], ['image','images']) /}
    <div class="form-group row">
        <label for="frm-{$vo['field_name']}" class="col-sm-2 col-12 row-form-label">{:__($vo['field_title'])}</label>
        <div class="col-sm-8 col-12 fileGroup {if $vo['form_type']=='images'}file-sortable file-json{/if}">
            <div class="file-btn">
                {php}$ext = !empty($vo['setting']['ext'])?'.'.str_replace('|',',.',$vo['setting']['ext']):"image/*";{/php}
                {php}$filesize = !empty($vo['setting']['filesize'])?$vo['setting']['filesize']:site('file_size');{/php}

                <input type="text"
                       class="form-control txt-files"
                       id="frm-{$vo['field_name']}"
                       name="row[{$vo['field_name']}]"
                       placeholder="{$vo['tips']}"
                       {if !empty($row[$vo['field_name']])}value='{$row[$vo['field_name']]}'{elseif !empty($vo['default_value'])}value="{$vo['default_value']}"{else /} value="" {/if} data-rule="{:str_replace(',',';',$vo['rules'])}" data-msg="{$vo['error_tips']}">
                <button type="button"
                        {if $vo['form_type']=='images'}data-file-num="{$vo['max_number']}"{/if}
                {:extend_options(['class'=>'btn btn-default btn-imgUpload','data-mimetype'=>$ext,'data-size'=>$filesize,'data-multiple'=>$vo['form_type']=='images'?true:false,'data-field'=>"frm-".$vo['field_name']], $vo['extend'], true)}><i class="fas fa-upload"></i> {:__('Upload')}</button>
                <button type="button"
                        {if $vo['form_type']=='images'}data-file-num="{$vo['max_number']}"{/if}
                {:extend_options(['class'=>'btn btn-default btn-imgSelect','data-mimetype'=>$ext,'data-size'=>$filesize,'data-multiple'=>$vo['form_type']=='images'?true:false,'data-field'=>"frm-".$vo['field_name']], $vo['extend'], true)}><i class="fas fa-images"></i> {:__('Select')}</button>

            </div>
            <div class="file-preview row mt-2"></div>
        </div>
        <div class="col-sm-2 form-tips">{if !empty($vo['tips'])}<span class="form-tips-span" data-tips="{$vo['tips']}"><i class="far fa-question-circle"></i></span>{/if}</div>
    </div>
    {elseif in_array($vo['form_type'], ['date', 'datetime']) /}
    <div class="form-group row">
        <label for="frm-{$vo['field_name']}" class="col-sm-2 col-12 row-form-label">{:__($vo['field_title'])}</label>
        <div class="col-sm-8 col-12">
            {php}if (isset($row[$vo['field_name']])&&is_numeric($row[$vo['field_name']])){ $row[$vo['field_name']] = date('Y-m-d H:i:s', $row[$vo['field_name']]); }{/php}
            {:build_input('text', 'row['.$vo['field_name'].']', $row[$vo['field_name']]??$vo['default_value'], extend_options([
                'class'=>'form-control laydate',
                'id'=>'frm-'.$vo['field_name'],
                'placeholder'=>$vo['tips'],
                'data-rule'=>str_replace(',',';',$vo['rules']),
                'data-msg'=>$vo['error_tips'],
                'data-type'=>$vo['form_type']
            ], $vo['extend']))}

        </div>
        <div class="col-sm-2 form-tips">{if !empty($vo['tips'])}<span class="form-tips-span" data-tips="{$vo['tips']}"><i class="far fa-question-circle"></i></span>{/if}</div>
    </div>
    {elseif in_array($vo['form_type'], ['downfile','downfiles']) /}
    <div class="form-group row">
        <label for="frm-{$vo['field_name']}" class="col-sm-2 col-12 row-form-label">{:__($vo['field_title'])}</label>
        <div class="col-sm-8 col-12 fileGroup {if $vo['form_type']=='downfiles'}file-sortable file-json{/if}">
            {php}$ext = !empty($vo['setting']['ext'])?'.'.str_replace('|',',.',$vo['setting']['ext']):"*";{/php}
            {php}$filesize = !empty($vo['setting']['filesize'])?$vo['setting']['filesize']:site('file_size');{/php}
            <div class="file-btn">
                <input type="text" class="form-control txt-files" id="frm-{$vo['field_name']}" name="row[{$vo['field_name']}]" placeholder="{$vo['tips']}" {if !empty($row[$vo['field_name']])}value='{$row[$vo['field_name']]}'{elseif !empty($vo['default_value'])}value="{$vo['default_value']}"{else /} value="" {/if} data-rule="{:str_replace(',',';',$vo['rules'])}" data-msg="{$vo['error_tips']}">
                <button type="button" {if $vo['form_type']=='downfiles'}data-file-num="{$vo['max_number']}"{/if} {:extend_options(['class'=>'btn btn-default btn-imgUpload','data-mimetype'=>$ext,'data-size'=>$filesize,'data-multiple'=>$vo['form_type']=='downfiles'?true:false,'data-field'=>"frm-".$vo['field_name']], $vo['extend'], true)}><i class="fas fa-upload"></i> {:__('Upload')}</button>
                <button type="button" {if $vo['form_type']=='downfiles'}data-file-num="{$vo['max_number']}"{/if} {:extend_options(['class'=>'btn btn-default btn-imgSelect','data-mimetype'=>$ext,'data-size'=>$filesize,'data-multiple'=>$vo['form_type']=='downfiles'?true:false,'data-field'=>"frm-".$vo['field_name']], $vo['extend'], true)}><i class="fas fa-images"></i> {:__('Select')}</button>
            </div>
            <div class="file-preview row mt-2"></div>
        </div>
        <div class="col-sm-2 form-tips">{if !empty($vo['tips'])}<span class="form-tips-span" data-tips="{$vo['tips']}"><i class="far fa-question-circle"></i></span>{/if}</div>
    </div>
    {elseif $vo['form_type']=='array' /}
    <div class="form-group row keyvalue">
        {php}if(isset($row[$vo['field_name']])){ $vo['value_array'] = $row[$vo['field_name']]?json_decode(htmlspecialchars_decode($row[$vo['field_name']]), true):[];}else{ $vo['value_array'] = $vo['default_value']?json_decode(htmlspecialchars_decode($vo['default_value']), true):[]; } {/php}

        {if empty($vo['value_array']) && !empty($vo['setting']['default_value'][app('cache')->get('admin_content_lang'.app('user')->id)])}
            {php}$vo['value_array'] = $vo['setting']['default_value'][app('cache')->get('admin_content_lang'.app('user')->id)];{/php}
        {/if}

        <script type="text/html" class="keyvalue-template">
            <div class="row pt-2">
                <div class="col-sm-5">
                    <input type="text" value="" data-name="keyvalue-key" {:extend_options(['class'=>'form-control', 'placeholder'=>$vo['tips'], 'data-rule'=>str_replace(',',';',$vo['rules']), 'data-msg'=>$vo['error_tips']], $vo['extend'], true)}>
                </div>
                <div class="col-sm-5">
                    <input type="text" value="" data-name="keyvalue-value" {:extend_options(['class'=>'form-control', 'placeholder'=>$vo['tips'], 'data-rule'=>str_replace(',',';',$vo['rules']), 'data-msg'=>$vo['error_tips']], $vo['extend'], true)}>
                </div>
                <div class="col-sm-2 d-flex align-items-center">
                    <a href="#" class="btn btn-default btn-xs btn-keyvalue-row-del"><i class="fas fa-times"></i></a>
                    <a href="javascript:;" class="btn btn-default btn-xs  ml-1"><i class="fas fa-arrows-alt"></i></a>
                </div>
            </div>
        </script>

        <label for="frm-{$vo['field_name']}" class="col-sm-2 col-12 row-form-label">{:__($vo['field_title'])}</label>
        <div class="col-sm-8 col-12" style="padding-top: calc(.375rem + 1px);padding-bottom: calc(.375rem + 1px);">
            <div class="row">
                <div class="col-sm-5">{$vo['data_list']['key']}</div>
                <div class="col-sm-5">{$vo['data_list']['value']}</div>
            </div>

            <textarea name="row[{$vo['field_name']}]" data-field="{$vo['field_name']}" class="key-value-textarea d-none">{$row[$vo['field_name']]??$vo['default_value']}</textarea>

            <div class="keyvalue-item">
                {volist name="vo['value_array']" id="item"}
                <div class="row pt-2">
                    <div class="col-sm-5">
                        <input type="text" value="{$key}" name="keyvalue{$i}" data-name="keyvalue-key" {:extend_options(['class'=>'form-control', 'placeholder'=>$vo['tips'], 'data-rule'=>str_replace(',',';',$vo['rules']), 'data-msg'=>$vo['error_tips']], $vo['extend'], true)}>
                    </div>
                    <div class="col-sm-5">
                        <input type="text" value="{$item}" name="keyvalue{$i}" data-name="keyvalue-value" {:extend_options(['class'=>'form-control', 'placeholder'=>$vo['tips'], 'data-rule'=>str_replace(',',';',$vo['rules']), 'data-msg'=>$vo['error_tips']], $vo['extend'], true)}>
                    </div>
                    <div class="col-sm-2 d-flex align-items-center">
                        <a href="#" class="btn btn-default btn-xs btn-keyvalue-row-del"><i class="fas fa-times"></i></a>
                        <a href="javascript:;" class="btn btn-default btn-xs  ml-1"><i class="fas fa-arrows-alt"></i></a>
                    </div>
                </div>
                {/volist}
            </div>

            <div class="row pt-3">
                <div class="col-sm-12">
                    <a href="#" class="btn btn-sm btn-default btn-keyvalue-row-add">{:__('Append')}</a> <a href="#!" data-url="{:url('/cms.ModelField/setSetting')}" class="btn-key-config">[{:__('Set as template')}]</a>
                </div>
            </div>
        </div>
        <div class="col-sm-2 form-tips">{if !empty($vo['tips'])}<span class="form-tips-span" data-tips="{$vo['tips']}"><i class="far fa-question-circle"></i></span>{/if}</div>
    </div>
    {/if}
{/volist}